﻿@using Kendo.Mvc.UI;

@{
    ViewBag.Title = "Thí sinh";
}
@{
    AjaxOptions aj = new AjaxOptions
    {
        InsertionMode = InsertionMode.Replace,
        UpdateTargetId = "content-main",
        LoadingElementId = "loading-icon",
        OnFailure = "AjaxFailure",
        OnBegin = "AjaxBegin",
        OnComplete = "AjaxComplete"
    };
}

@using (@Html.BeginForm("SelectTrainingSystem", "CandidateManagement", FormMethod.Post))
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)
    <div class="panel-body">
        <header class="panel-heading" style="margin-bottom:40px">
            <h4 style="margin:0">Lựa chọn Đào tạo</h4>
        </header>
        
        <div class="form-group">
            <div class="col-lg-6 col-md-6">
                <div class="col-lg-3 col-md-3">
                    <strong>Hệ đào tạo:</strong>
                </div>
                <div class="col-lg-6 col-md-6 row">
                    @Html.DropDownList("MaHeDaoTao", (SelectList)ViewBag.HeDaoTao, "Chọn Hệ đào tạo...", new { @class = "form-control valid", data_val = "true", data_val_required = " ", id = "MaHeDaoTao", aria_required = "true", aria_invalid = "true", aria_describedby = "MaHeDaoTao-error MaHeDaoTao-error MaHeDaoTao-error" })
                    @Html.ValidationMessage("MaHeDaoTao")
                </div>
            </div>
            <div class="col-lg-6 col-md-6">
                <div class="col-lg-3 col-md-3">
                    <strong>Bậc đào tạo:</strong>
                </div>
                <div class="col-lg-6 col-md-6 row">
                    @Html.DropDownList("MaBacDT", new SelectList(Enumerable.Empty<SelectListItem>()), "Chọn Bậc đào tạo...", new { @class = "form-control valid", data_val = "true", data_val_required = " ", id = "MaBacDT", aria_required = "true", aria_invalid = "true", aria_describedby = "MaBacDT-error MaBacDT-error MaBacDT-error" })
                    @Html.ValidationMessage("MaBacDT")
                </div>
            </div>
        </div>

        <div style="clear:both"></div>
        <div class="form-group">
            <div class="col-lg-12 col-md-12">
                <div class="toolbar" style="float:right">
                    <button class="btn btn-primary btn-primary-registration" type="submit"><b>  Tiếp theo</b></button>
                </div>
            </div>
        </div>
        <div style="clear:both"></div>
    </div>
    @Scripts.Render("~/bundles/jqueryval")
}
<script>
    $("#MaHeDaoTao").change(function () {
        var ID = $(this).val();
        $("#MaBacDT").html('').append($('<option />', {
            value: 0,
            text: "Chọn Bậc đào tạo..."
        }));
        $.getJSON("/Admin/CandidateManagement/GetTLByTS", { TSID: ID },
               function (data) {
                   var select = $("#MaBacDT");
                   select.empty();
                   select.append($('<option />', {
                       value: 0,
                       text: "Chọn Bậc đào tạo..."
                   }));
                   $.each(data, function (index, itemData) {
                       select.append($('<option />', {
                           value: itemData.Value,
                           text: itemData.Text
                       }));
                   });
               });
    });
</script>
